package com.android.personal.kotlin.client;


import com.android.personal.kotlin.response.AllCpResponse;
import com.android.personal.kotlin.response.InspectReasonResponse;

import java.util.HashMap;
import java.util.Map;

import retrofit2.Callback;

/**
 * Created by zhangwentao on 2016/11/18.
 */

public class ApiFactory {

    private volatile static ApiFactory mApiFactory;

    private ApiFactory() {}

    public static ApiFactory getInstance() {
        if (mApiFactory == null) {
            synchronized (ApiFactory.class) {
                if (mApiFactory == null) {
                    mApiFactory = new ApiFactory();
                }
            }
        }
        return mApiFactory;
    }

    public void getCp(Callback<AllCpResponse> callback) {
        ApiManager.getRetrofitService().getCp().enqueue(callback);
    }

    public void getInspectReservation(String categroyId, Callback<InspectReasonResponse> callback) {
        ApiManager.getRetrofitService().getInspectReservation(categroyId).enqueue(callback);
    }

    public void getInspectReservationString(Map<String, Object> map, Callback<String> callback) {
        if (map.size() == 0 || null == map) {
            return;
        }
        ApiManager.getRetrofitService().getInspectReservationString(map).enqueue(callback);
    }
}
